perm filename MANTST.TEX[TEX,DEK]1 blob
sn#651079 filedate 1982-04-05 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00009 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 \input newhdr
C00003 00003 \chapterbegin 1. The Name\\of\\The Game
C00006 00004 \chapterbegin 2. Book Printing\\versus\\Ordinary Typing
C00016 00005 \chapterbegin 3. Controlling\\\TEX
C00036 00006 \chapterbegin 4. Fonts\\of\\Type
C00047 00007 \chapterbegin 13. Modes
C00056 00008 \chapterbegin 18. Fine Points\\of\\Mathematics\\Typing
C00065 00009 ...and so on.
C00066 ENDMK
C⊗;
\input newhdr
\tenpoint
\chapterbegin 1. The Name\\of\\The Game
English words like ``technology'' stem from a Greek root beginning with
the letters $\tau\epsilon\chi\ldotsm$; and this same Greek word means {\sl art}
as well as technology. Hence the name \TEX, which is an upper-case form of
$\tau\epsilon\chi$.
Insiders pronounce the $\chi$ of \TEX\ as a Greek chi, not as an ``x'', so that
\TEX\ rhymes with the word blecchhh. It's the ``ch'' sound in Scottish words
like {\sl loch} or German words like {\sl ach}; it's a Spanish ``j'' and a
Russian ``kh''. When you say it properly to your computer, the terminal
may become slightly moist.
The purpose of this pronunciation exercise is to remind you that \TEX\ is
primarily concerned with high-quality technical manuscripts: its emphasis is
on art and technology, as in the underlying Greek word. If you merely want
to produce passably good quality---something acceptable and basically
readable but not really beautiful---a simpler system will usually suffice.
With \TEX\
the goal is to produce the {\sl finest} quality; this requires more attention
to detail, but fortunately it is not that much harder to go this extra
distance, and you can take special pride in the finished product.
On the other hand you might find it more comfortable to pronounce \TEX\ as
a Texan would and to shrug off all this high-falutin' nonsense about beauty
and quality. Go ahead and do what you want, the computer won't mind.
\exno 1.1: After you have mastered the material in this book, what will you be:
A \TEX pert, or a \TEX nician?
\endingquote
Virginia Woolf by any other name\\would be Gertrude Stein.
\author WILLIAM SHAKESPEARE (1608)
\chapterbegin 2. Book Printing\\versus\\Ordinary Typing
When you first started using a computer terminal, you probably had to adjust
to the difference between the digit ``1'' and the lower case letter ``l''.
When you take the next step to the level of typography that is common in
book publishing, a few more adjustments of the same kind need to be made.
In the first place, there are two kinds of quotation marks in books, but only
one kind on the typewriter. Even your computer terminal, which has more characters
than an ordinary typewriter, probably has only a non-oriented double-quote
mark ({\tt "}),
because the standard ``ascii'' code for computers was not
invented with book publishing in mind. However, your terminal probably does have
two flavors of single-quote marks, namely ` and ', which you can get by typing
{\≡≡`≡\} and {\≡≡'≡\}. The second of
these is useful also as an apostrophe.
To produce double-quote marks with \TEX, you simply type two single-quote marks
of the appropriate kind. For example, to produce an output like
$$\display\hbox{``I understand.''}$$
(including the quotation marks) you would type
$$\displaybox{{\≡≡`≡`I understand.≡'≡'≡\}\hfill}$$
on your terminal.
A typewriter-like style of type will be used throughout this manual to indicate
\TEX\ constructions you might type on your terminal, so that the
symbols actually typed are readily distinguishable from the output \TEX\ would
produce and from the comments in the manual itself. Here are the symbols to be
used in the examples:
$$\save1\hbox{\≡0123456789"#$%&@*+-=,.:;?!≡\}
\save2\hbox{\≡()<>≡≤≡≥[]{}≡`≡'→↑≡↓←\|/⊗≡spose/=≡∞≡\}
\display\eqalign{⊗\hbox{\tt ABCDEFGHIJKLMNOPQRSTUVWXYZ}\cr
⊗\hbox{\tt abcdefghijklmnopqrstuvwxyz}\cr
⊗\box1\cr
⊗\box2\cr}$$
If these are not all on your computer terminal, don't despair; \TEX\ can make
do with the ones you have. One additional symbol
$$\display\hbox{\tt\char'40}$$
is also used to stand for a {\sl blank space}, in case it is important to
emphasize that a blank space is typed; without such a symbol you would have
difficulty seeing the invisible parts of certain examples.
Another important distinction between book printing and ordinary typing is
the use of dashes, hyphens, and minus signs. In good math books, these
symbols are all different; in fact there are usually at least four different
symbols in use:
$$\display\vbox{\halign{#\hfill\cr
a hyphen (-);\cr
an en-dash (--);\cr
an em-dash (---);\cr
a minus sign ($-$).\cr}}$$
Hyphens are used for compound words like ``daughter-in-law'' and ``X-rated''.
En-dashes are used for number ranges like ``pages 13--34'' and also in
contexts like ``exercise 1.2.6--52''. Em-dashes are used for punctuation in
sentences---they are what we often call simply dashes. And minus signs are
used in math formulas. A conscientious user of \TEX\ will be careful to distinguish
these four usages, and here is how to do it:
$$\displaybox{\vbox{\halign{#\hfill\cr
for a hyphen, type a hyphen ({\tt -});\cr
for an en-dash, type two hyphens ({\tt --});\cr
for an em-dash, type three hyphens ({\tt ---});\cr
for a minus sign, type a hyphen in mathematics mode ({\≡$-$≡\}).\cr}}\hfill}$$
(Mathematics mode occurs between dollar signs; it is discussed later, so you
needn't worry about it now.)
\yskip
If you look closely at most well-printed books, you will find that certain
combinations of letters are treated as a unit. For example, this is true of the
``f'' and the ``i'' of ``find''. Such combinations are called {\sl ligatures},
and professional typesetters have traditionally been trained to watch for letter
pairs such as {\tt ff}, {\tt fi}, {\tt fl}, {\tt ffi}, and {\tt ffl}.\xskip (It's
somewhat surprising how often these combinations appear.) Fortunately you do
{\sl not} have to concern yourself with ligatures, since \TEX\ is perfectly
capable of handling such things by itself. In fact, \TEX\ will also look
for combinations of adjacent letters (like ``{\tt A}'' next to ``{\tt V}'')
that ought to be moved closer together for better appearance; this is
called {\sl kerning}.
\yyskip
To summarize this chapter: When using \TEX\ for straight copy, you type the copy as
on an ordinary typewriter, except that you need to be careful about quotation
marks, the number 1, and various kinds of hyphens/dashes. \TEX\ will take
care of other niceties like ligatures and kerning.
\danger In case you need to type quotes within quotes, for example a single quote
followed by a double quote, you can't simply type {\≡≡'≡'≡'≡\} because \TEX\
will interpret this as ''' (namely, double-quote followed by single-quote).
If you have already read Chapter 5, you might expect that the solution will be to
use grouping---namely, to type something like
{\≡{≡'}≡'≡'≡\}. But it turns out that this doesn't produce the
desired result, because there is usually more space following a double quote
than there is following a single quote: What you get is '{}'', which is indeed
a single quote followed by a double quote (if you look at it closely enough),
but it looks almost like three equally-spaced single quotes.
On the other hand, you certainly won't want to type {\≡≡'≡char'40≡'≡'≡\}, because
this space is much too large---just as large as the space between words---and
\TEX\ might even start a new line at such a space when making up a
paragraph! There are at
least two ways to solve the problem, both of which involve more complicated
features of \TEX\ that we shall study later. First, if you
have a definition such as
$$\displaybox{{\≡\def\2{\hbox to 2pt{}}≡\}\hfill}$$
in the format of your manuscript, you can type {\≡≡'\2≡'≡'≡\}.
This definition puts 2 points of blank space
between the quotes, so the result is '\hbox to 2pt{}''; you could, of
course, vary the amount of space, or define another control sequence besides
{\≡\2≡\} for this purpose. Second, you could use the idea of ``thin space'' in
math formulas: namely, if you type {\≡≡'$\,$≡'≡'≡\} the result will be '$\,$''.
\danger\dexno 2.1: OK, now you know how to produce ''' and '$\,$''; how do you
get ``$\,$` and `{}``$\,$?\enddanger
\endingquote
I have to think up a quotation to end this chapter.
\author DONALD E. KNUTH (1982)
\chapterbegin 3. Controlling\\\TEX
Your keyboard has very few keys compared to the large number of symbols that you
may want to specify. In order to make a limited keyboard sufficiently versa\-tile,
one of the characters you can type is reserved for special use, and it is called
the {\sl escape character}. Whenever you want to type something that controls the
format of your manuscript, or something that doesn't use the keyboard in the
ordinary way, you type the escape character followed by an indication of what
you want to do.
You get to choose your own escape character. It can be any typeable symbol,
preferably some character found in a reasonably convenient location on your
keyboard, yet it should be a symbol that is rarely (if ever) used in the manuscript
you are typing. For our purposes in this manual, the ``backslash'' character
``{\≡\≡\}''
will be used as the escape in all the examples. You may wish to adopt backslash as
your personal escape symbol, but \TEX\ doesn't have any character built in for this
purpose. In fact, \TEX\ always takes {\sl the first nonblank character} you give it
and assumes that it is to be your escape character.
Note: Some computer terminals have a key marked ``{\tt ESC}'', but that is {\sl not}
your escape character! It is a key that sends a special message to the operating
system, so don't confuse it with what this manual calls ``escape''.
Immediately after typing ``{\≡\≡\}''
(i.e., immediately after an escape char\-acter) you
type a coded command telling \TEX\ what you have in mind. Such commands are called
{\sl control sequences}. For example, you might type
$$\displaybox{{\≡\input ms≡\}\hfill}$$
which (as we will see later) causes \TEX\ to begin reading a file called ``{\tt
ms.TEX}''; the string of characters ``{\≡\input≡\}'' is a control sequence.
Here's another example:
$$\displaybox{{\≡George P\≡'olya and Gabor Szeg\"o.≡\}\hfill}$$
\TEX\ converts this to ``George P\'olya and Gabor Szeg\"o.'' There are two
control sequences, {\≡\≡'≡\} and {\≡\"≡\}, in this example, and they are used
to indicate the special accents.
Control sequences come in two flavors. The first kind, like {\≡\input≡\}, consists
of the escape character followed by one or more letters, followed by a space or by
something besides a letter.\xskip
(\TEX\ has to know where the control sequence ends,
so you have to put a space after a control sequence if the following character is
a letter; for example, if you type ``{\≡\inputms≡\}'', \TEX\ will interpret this as
a control sequence with seven letters.)\xskip
The second variety of control sequence,
like {\≡\≡'≡\}, consists of the escape character
followed by a single {\sl nonletter}. In this case you don't need a space to
separate the control sequence from a letter that follows, since control
sequences of the second kind always have a single symbol after the escape.
When a space comes after a control sequence (of either kind), it is ignored by
\TEX; i.e., it is not considered to be a ``real'' space belonging to the
manuscript being typeset. Thus, the example above could have been
typed as
$$\displaybox{{\≡George P\≡'≡ olya and Gabor Szeg\" o.≡\}\hfill}$$
\TEX\ will treat both examples the same way; it {\sl always} discards spaces
after control sequences.
So the question arises, what do you do if you actually {\sl want} a space to
appear after a control sequence? We will see later that \TEX\ treats two or
more consecutive spaces as a single space, so the answer is {\sl not} going to be
``type two spaces.'' The correct answer is to type ``escape space'', namely
$$\displaybox{{\≡\≡char'40≡\}\hfill}$$
(the escape character followed by a blank space); \TEX\ will treat this as
a space not to be ignored. Note that escape-space is a control sequence of the
second kind, since there is a single nonletter ({\tt\char'40}) following the
escape character. According to the rules, further spaces immediately following
{\≡\≡char'40≡\} will be ignored, but if you want to enter, say, three consecutive
spaces into a manuscript you can type ``{\≡\≡char'40\≡char'40\≡char'40≡\}''.
Incidentally, typists are often taught to put two spaces at the ends of
sentences; but we will see later that \TEX\ has its own way to produce extra space
in such cases. Thus you needn't be consistent in the number of spaces you type.
It is usually unnecessary for you to use ``escape space'', since control sequences
aren't often needed at the ends of words. But here's an example that might shed
some light on the matter: This manual itself has been typeset by \TEX, and one of
the things that occurs fairly often is the tricky logo ``\TEX'', which requires
backspacing and lowering the E. We will see below that it is possible for any
user to define new control sequences to stand as abbreviations of commonly
occurring constructions; and at the beginning of this manual, a special definition
was made so that the control sequence$$\displaybox{{\≡\TEX≡\}\hfill}$$ would produce the
instructions necessary to typeset ``\TEX''. When a phrase like
``\TEX\ ignores spaces after control sequences.'' is to be typeset, the manuscript
renders it as follows:
$$\displaybox{{\≡\TEX\ ignores spaces after control sequences≡\}.\hfill}$$
Notice the extra {\≡\≡\} following {\≡\TEX≡\}; this produces the escape-space
that is necessary because \TEX\ ignores spaces after control sequences. Without
this extra {\≡\≡\}, the result would have been
$$\displaybox{\TEX ignores spaces after control sequences.\hfill}$$
Consider also what happens if {\≡\TEX≡\} is not followed by a space, as in
$$\displaybox{{\≡the logo ≡`≡`\TEX≡'≡'≡\}.\hfill}$$
It would be permissible to put a blank space after the {\tt X}, but not an
escape character; if the manuscript were changed to read
$$\displaybox{{\≡the logo ≡`≡`\TEX\≡'≡'≡\}\hfill}$$
the result would be curious indeed---can you guess it?\xskip Answer: The {\≡\≡'≡\}
would be a control sequence denoting an acute accent, as in our {\≡P\≡'olya≡\}
example above; the effect would therefore be to put an accent over the
next nonblank character,
which as it happens is a single-quote mark. In other words, the result would be
$$\display\hbox{the logo ``\TEX\''}$$
because the ligature that changes {\≡≡'≡'≡\} into '' is not recognized.
\exno 3.1: State two ways to specify the French word ``math\'ematique''. Can
you guess how the word ``centim\`etre'' should be specified?
\yyskip
\TEX\ understands almost 300 control sequences as part of its standard
built-in vocabulary,
and all of these are explained in this manual somewhere. Fortunately you won't
have too much trouble learning them, since the vast majority are simply the
names of special characters used in mathematical formulas. For example, the
control sequences {\≡\Ascr≡\}, {\≡\Bscr≡\}, $\ldotss$, {\≡\Zscr≡\} stand for
the upper case script letters $\Ascr$, $\Bscr$, $\ldotss$, $\Zscr$; and you can
type ``{\≡\aleph≡\}'' to get $\aleph$, ``{\≡\doteq≡\}'' to get $\doteq$,
``{\≡\oplus≡\}'' to
get $\oplus$, ``{\≡\←≡\}'' to get $\←$, etc.
As mentioned above, \TEX\ can be taught to understand other control sequences
besides those in its primitive vocabulary. For example, ``{\≡\TEX≡\}'' is not one of
the standard control sequences; it had to be defined specially for producing
this manual. In general there will be special control sequences that define the
{\sl style} of a book or a series of books: they will be used at the beginning of
chapters, or to handle special formats such as might be used in a bibliography,
etc. Such style-defining control sequences are usually defined once and for all
by \TEX\ wizards who are
skilled in the lore of control-sequence definition; novice
\TEX\ users don't have to worry about the job of defining any new control
sequences; the only problem is to learn how to use somebody else's definitions.\!
\xskip
(The person who designs a \TEX\ style is obliged to write a supplement to this
manual explaining how to use his or her control sequences.)
In this manual we shall frequently refer to a so-called ``basic \TEX\ style''
consisting of the definitions in Appendix B, since these basic definitions
have proved to be useful for common one-shot jobs. Appendix E contains an
example of a more elaborate style, namely the definitions used to typeset
D. E. Knuth's series of books on {\sl The Art of Computer Programming}. There's
no need for you to look at these appendices now, they are included only for
reference purposes.
The main point of these remarks, as far as novice \TEX\ users are concerned, is
that it is indeed possible to define nonstandard \TEX\ control sequences, but it
can be tricky. You can safely rely on the standard control sequences, and
on the basic extensions defined in Appendix B (which will be explained later in this
manual), until you become an experienced \TEX nical typist.
\danger Those of you who wish to define control sequences should know that \TEX\
has further rules about them, namely that many different spellings of the same
control sequence may be possible. This fact allows \TEX\ to handle control
sequences quite efficiently; and \TEX's usefulness is not seriously affected,
because new control sequences aren't needed very often.
A control sequence of the first kind (i.e., one
consisting of letters only) may involve both upper case and lower case letters,
but the distinction between cases is ignored after the first letter. Thus {\≡\TEX≡\}
could also be typed ``{\≡\TEx≡\}'' or ``{\≡\TeX≡\}'' or ``{\≡\Tex≡\}''---each
of these four
has the same meaning and the same effect. But ``{\≡\tex≡\}'' would {\sl not} be the
same, because there {\sl is} a case distinction on the first letter.\xskip (Typing
``{\≡\gamma≡\}'' results in $\gamma$, but ``{\≡\Gamma≡\}'' or ``{\≡\GAMMA≡\}''
results in $\GammA$.)
\danger Another rule takes over when there are seven or more letters after the
escape:
all letters after the seventh are replaced by ``{\tt x}'', and then groups of
eight letters are removed if necessary until at most 14 letters are left.
Thus {\≡\underline≡\} is the same as {\≡\underlixx≡\}; and it is also the same
as {\≡\underlinedsymbols≡\} or any other control sequence that starts with
{\≡\u≡\} followed by {\tt n} or {\tt N}, then {\tt d} or {\tt D}, then {\tt e} or
{\tt E}, then {\tt r} or {\tt R}, then {\tt l} or {\tt L}, then {\tt i} or
{\tt I}, then 2 or 10 or 18 or 26 or $\cdots$ letters. But {\≡\underline≡\} is
not the same as {\≡\underlines≡\}, because these two control sequences don't
have the same length modulo 8.
\danger As a consequence of these rules, there are 128 essentially distinct control
sequences of length two---namely, escape followed by any 7-bit character, whether a
letter or not. There are $52\times26$ essentially distinct control sequences of
length three, because there are $26+26=52$ choices for the first letter following
the escape and 26 different choices for the second letter; there are
$52\times26\times26$ essentially distinct control sequences of length four,
$52\times26\times26\times26$ of length five, $52\times26\times26\times26\times26$
of length six, $52\times26\times26\times26\times26\times26$ of length seven.
There are $52\times26\times26\times26\times26\times26\times26$ essentially
distinct control sequences of length 8 plus a multiple of↔8, and the same number
holds for length 9 plus a multiple of 8, $\ldotss$, length
15 plus a multiple of 8. Thus
the total number of distinct control sequences available is exactly
$$\display128+52\cdot26+52\cdot26↑2+\cdots+52\cdot26↑5+8\cdot52\cdot26↑6
=129151507704;$$
that should be enough. Even though \TEX\ accepts alternative spellings, you should
be consistent in each manuscript, since some implementations of \TEX\ may not be
exactly the same in this respect.
\danger Nonprinting control characters like $\langle\hbox{carriage-return}\rangle$
might follow an
escape character, and these lead to distinct control sequences according to the
rules. Initially \TEX\ is set up to treat each of
{\≡\≡\}$\langle$tab$\rangle$ and
{\≡\≡\}$\langle\hbox{line-feed}\rangle$ and {\≡\≡\}$\langle
\hbox{vertical-tab}\rangle$ and {\≡\≡\}$\langle\hbox{form-feed}\rangle$ and
{\≡\≡\}$\langle\hbox{carriage-return}\rangle$ the same as {\≡\≡char'40≡\}
(escape space); it is recommended that none of these six control sequences
be redefined.\enddanger
\endingquote
All Freestanding subheads\\ appearing at the base of the page\\
must be followed by a minimum of 3 text lines.
\author ADDISON--WESLEY (1981)
\chapterbegin 4. Fonts\\of\\Type
Occasionally you will want to change from one typeface to another, for example
if you wish to be {\bf bold} or to {\sl emphasize} something. \TEX\ deals with
sets of 128 characters called ``fonts'' of type, and the control sequence
{\≡\:≡\} is used to select a particular font. If, for example, fonts {\tt n},
{\tt b}, and {\tt s} have been predefined to represent normal, bold, and
slanted styles of type, you might specify the last few words of the first
sentence of this paragraph in the following way:
$$\displaybox{{\≡to be \:b bold \:n or to \:s emphasize \:n something.≡\}\hss}$$
(Blank spaces after font codes like {\tt b} are ignored by \TEX\ just like
the spaces after control sequences; furthermore, since a font code is always of
length 1, you don't need a space after it. Thus, {\≡\:bbold≡\} would be treated
the same as {\≡\:≡char'40b≡char'40≡char'40bold≡\}.
It is probably best to type a space after the font codes, even though you
don't really need one, for the sake of readability.)
You probably will never\footnote*{Well$\ldotsm$, hardly ever.}
use the {\≡\:≡\} sequence yourself, since
the pre\-designed format you are using usually includes special control sequences
that give symbolic names to the fonts. For example, the ``basic \TEX\ format''
in Appendix↔B defines three control sequences for this purpose.
$$\displaybox{\vbox{\halign{# \hfill⊗#\hfill\cr
{\≡\rm≡\} switches to the normal ``Roman'' typeface: ⊗Roman\cr
{\≡\sl≡\} switches to a slanted typeface:⊗{\sl Slanted}\cr
{\≡\bf≡\} switches to a boldface style:⊗{\bf Bold}\cr}}\hfill}$$
With such a system, you can type the above example as
$$\displaybox{{\≡to be \bf bold \rm or to \sl emphasize \rm something.≡\}\hss}$$
The advantage of such control sequences is that you can use the same abbreviations
{\≡\rm≡\}, {\≡\sl≡\}, {\≡\bf≡\} in any size of type, although different font
codes are actually used for different sizes. For example, fonts {\tt a},
{\tt n}, {\tt q} might be the normal, slanted, and bold fonts in a standard
``10-point'' size of type, while {\tt c}, {\tt p}, {\tt s} might be the
corresponding fonts in a smaller ``8-point'' size. It would be difficult to
remember how the codes change in different sizes. So the {\sl Art of Computer
Programming} book design in Appendix E allows you to say
$$\displaybox{{\≡\tenpoint≡\}\hfill}$$
whenever you are beginning to type material that belongs in 10-point size,
after which {\≡\rm≡\} will be equivalent to {\≡\:a≡\}, and {\≡\sl≡\} will be
equivalent to {\≡\:n≡\}, etc. Now if you switch to 8-point size (in a
footnote, say) the instruction
$$\displaybox{{\≡\eightpoint≡\}\hfill}$$
(which appears in the {\≡\footnote≡\} format) will cause {\≡\sl≡\} to be
equivalent to {\≡\:p≡\}. All you need to remember is the abbreviations
{\≡\rm≡\}, {\≡\sl≡\}, and {\≡\bf≡\} regardless of what type size you are using.
\yyskip
There actually is a better way yet to handle the above example, using \TEX's
``grouping'' feature, which we shall discuss in the next chapter. With this
feature you would type
$$\displaybox{{\≡to be {\bf bold} or to {\sl emphasize} something.≡\}\hfill}$$
As we will see, switching fonts within {\≡{≡\} and {\≡}≡\} does not affect
the fonts outside, so you don't need to say explicitly that you are returning to
{\≡\rm≡\} in this scheme. Thus, you can pretty much forget about the other
ways we have been discussing for font switching; it's best to use grouping.
\danger Of course \TEX\ can make use of hundreds of different fonts in different
jobs. The 32-font restriction applies only within a particular job, because
\TEX\ doesn't want to keep the details about more than $32\times128=4096$
characters in its memory at once; there isn't enough room.
Thus the internal font codes will refer, in
general, to different ``real'' fonts. The first time you use a font code, you
must {\sl define} it by giving the full name of the font in the system's
collection. For example, when the basic \TEX\ format in Appendix B says
$$\displaybox{{\≡\:a=cmr10≡\}\hfill}$$
this selects font code {\tt a} and defines it to be the system's font ``cmr10'',
an abbreviation for ``Computer Modern Roman 10 point''. The rule for defining a
font is that the font code ({\tt a} in this example) must be followed immediately
by ``{\tt=}'' or ``{\tt←}'' (not a space) when it first appears, and this
must be followed immediately by the system name of the font file; then comes a
blank space to denote the end of the font file name.
\danger Once a font code is defined, it can never be redefined again. Thus if
you type, say, ``{\≡\:a=cmr10≡\}'' when font code {\tt a} has already been defined,
the characters ``{\tt =cmr10}'' will be treated as part of your manuscript, and
they will dutifully be set into type (in font {\tt a}). It's best to define
all your fonts in format specifications at the very beginning of your
input.\enddanger
When you change fonts within a line, \TEX\ will line the letters up according to
their
``baselines.'' For example, suppose that font codes {\tt a}, {\tt b}, {\tt c},
{\tt d}, {\tt e}, {\tt f} refer respectively to 10-point, 9-point, 8-point,
7-point, 6-point, and 5-point roman fonts; then if you type
$$\displaybox{{\vbox{\halign{#\hfill\cr
{\≡\:a smaller \:b and smaller \:c and smaller≡\}\cr
{\≡\:d and smaller \:e and smaller \:f and smaller \:a≡\}\cr}}}\hss}$$
the result is smaller \:b and smaller \:c and smaller \:d and smaller \:e
and smaller \:f and smaller\:a. Of course this is something authors don't
do very often at the moment, because printers can't do such things
easily with traditional lead types. Perhaps poets who wish to
speak in \:f a still small voice \:a will cause future books to make use of
frequent font variations, but nowadays it's only an occasional font freak \:f(like
the author of this manual)\:a\ who likes it. One should not get too carried away
by the prospect of font switching unless there is good reason.
\eject
\exno 4.1: Explain how to type the bibliographic reference ``Ulrich Dieter,
{\sl Journal f\"ur die reine und angewandte Mathematik \bf 201} (1959), 37--70.''
\endingquote
Don Knuth's Tau Epsilon Chi (\TEX) is potentially\\
the most significant invention in typesetting in this century.\\
So buy this book.
\author C. GORDON BELL (1979)
\chapterbegin 13. Modes
Just as people get into different moods, \TEX\ gets into different ``modes.''\!
\xskip
(Except that \TEX\ is more predictable than people.)\xskip There are six modes:
\def\¬{\yskip\textindent{\bull}\hang after 1 }
\yskip\¬Vertical mode. [Building the vertical list used to make
the pages of output.]
\¬Restricted vertical mode. [Building a vertical list for
a box within a page.]
\¬Horizontal mode. [Building the horizontal list used to make
the next paragraph for the output pages.]
\¬Restricted horizontal mode. [Building a horizontal list for
a box within a page.]
\¬Math mode. [Building a mathematical formula to be placed in
a horizontal list.]
\¬Display math mode. [Building a mathematical formula to be placed
on a line by itself, temporarily interrupting the current paragraph.]
\yyskip\noindent In simple situations, you don't need to be aware of what mode
\TEX\ is in, because it just does the right thing. But when you get an error
message that says ``{\≡You can't do that in horizontal mode≡\}'', a knowledge
of modes helps explain why \TEX\ thinks you goofed.
Basically \TEX\ is in one of the vertical modes when it is preparing a list of
boxes and glue that will be placed vertically on top of one another; it's in
one of the horizontal modes when it is preparing a list of boxes and glue that
will be strung out horizontally next to each other with baselines aligned;
and it's in one of the math modes when it is reading a math formula.
A play-by-play account of a typical \TEX\ job should make the mode idea clear:
At the beginning, \TEX\ is in vertical mode, ready to construct pages. If you
specify glue or a box when \TEX\ is in vertical mode, the glue or the box gets
placed on the current page below what has already been specified. For example,
the {\≡\vskip≡\} instructions in the sample run we discussed in Chapter 6
contributed vertical glue to the page; and the {\≡\ctrline{MY STORY}≡\}
instruction contributed a box to the page. While building the {\≡\ctrline≡\}
box, \TEX\ went temporarily into restricted horizontal mode, but returned
to vertical mode after setting the glue in that box.
Continuing with the example of Chapter 6, \TEX\ switched into horizontal
mode as soon as it read the ``{\tt O}'' of ``{\tt Once upon a time}''. Horizontal
mode is the mode for making paragraphs. The entire paragraph up to the {\≡\par≡\}
was input in horizontal mode; then it was divided into lines of the appropriate
length, these lines were appended to the page (with appropriate glue between
them), and \TEX\ was back in vertical mode.
In general when \TEX\ is in vertical mode,
the first character of a new paragraph changes the mode to horizontal for the
duration of a paragraph. If a begin-math character ({\≡$≡\}) appears when in
horizontal mode, \TEX\ plunges into math mode, processes the formula up until
the closing {\≡$≡\}, then adds the text of this formula to the current
paragraph and returns to horizontal mode.\xskip (Thus, in the ``I wonder why?''\
example of the previous chapter, \TEX\ would go into math mode temporarily
while processing {\≡\ldots≡\}, treating the dots as a formula.)
However, if two consecutive begin-math characters ({\≡$$≡\}) appear in some paragraph,
\TEX\ interrupts the paragraph where it is, contributes the paragraph-so-far
to the page, then processes a math formula in display math mode, then
contributes this formula to the current page, then returns to horizontal mode
for more of the paragraph.\xskip (The formula to be displayed should end with
{\≡$$≡\}.)\xskip For example, if you type
$$\displaybox{{\≡the number $$\pi \approx 3.1415926536$$ is important≡\}\quad,\hss}$$
\TEX\ goes into display math mode between the {\≡$$≡\}'s, and the output you
get states that the number
$$\pi\approx3.1415926536$$ is important.
\danger \TEX\ gets into restricted vertical mode when you ask it to construct
a box from a vertical list of boxes (using {\≡\vbox≡\} or {\≡\valign≡\}) or
when you do {\≡\topinsert≡\} or {\≡\botinsert≡\}. It gets into restricted
horizontal mode when you ask it to construct a box from a horizontal list
of boxes (using {\≡\hbox≡\} or {\≡\halign≡\}). Box construction is discussed
in Chapter 21. Restricted modes are like the corresponding unrestricted ones
except that you can't do certain things. For example, you can't say {\≡$$≡\}
in restricted horizontal mode, because you're not making a paragraph. You can't
begin a paragraph in restricted vertical mode, etc. All the rules about what
you can do in various modes are summarized in Chapters 24--26.\enddanger
When handling simple manuscripts, \TEX\ spends almost all of its time in
horizontal mode (making paragraphs), with brief excursions into vertical
mode (between paragraphs).
\yskip
At the end of a job, you type ``{\≡\end≡\}'' at some point when \TEX\ is in vertical
mode; this causes \TEX\ to finish any unfinished pages and stop.\xskip (Actually it
is better to type ``{\≡\vfill\end≡\}'' in most cases, since {\≡\vfill≡\} inserts
enough space to fill up the last page properly. Without the {\≡\vfill≡\},
\TEX\ attempts to stretch out the lines it has accumulated for the last
page, with the bottom line appearing at the bottom of the page; you probably
don't want this.)
\endingquote
Don't believe my husband when he says that\\
he will surely have this book done by the end of next March.
\author JILL KNUTH (1981)
\chapterbegin 18. Fine Points\\of\\Mathematics\\Typing
We have discussed most of the facilities needed to construct math formulas,
but there are several more things that a good mathematical typist will want to
watch for. You'll find it useful to reread this chapter after you have typed
your first paper that is heavily laden with math; and you should read it now, too.
\subsec1. Punctuation. When a formula is followed
by a period, comma, semicolon, colon, question mark, exclamation point, etc.,
put the punctuation {\sl after} the {\≡$≡\}, when the formula is in the text;
but put the punctuation {\sl before} the {\≡$$≡\} when the formula is displayed.
For example,
$$\displaybox{{\≡If $x<0$, we have shown that $$y=f(x).$$≡\}\hfill}$$
The reason is that \TEX's spacing rules within paragraphs work best when the
punctuation marks are not considered part of the formulas.
Similarly, don't type something like this:
$$\hbox to size{\hskip 3pc{\≡for $x = a, b$, or $c$.≡\}\hfill}$$
It should be
$$\hbox to size{\hskip 3pc{\≡for $x = a$, $b$, or $c$.≡\}\hfill}$$
The reason is that \TEX\ will always put a ``thin space'' between the comma and
the {\tt b} in \hbox{\≡$x = a, b$≡\}. This space will probably not be the
same as the space \TEX\ puts after the comma {\sl after} the {\tt b}, since the
second comma is outside the formula; and such unequal spacing would look bad.
When you type it right, the spacing will look good. Another reason for
not typing ``\hbox{\≡$x = a, b$≡\}'' is that it inhibits the possibilities
for breaking lines in a paragraph: \TEX\ will never break at the space between
the comma and the {\tt b} because breaks after commas in formulas are usually
wrong. For example, in the equation ``\hbox{\≡$x = f(a, b)$≡\}'' we certainly
don't want to put ``$x=f(a,$'' on one line and ``$b)$'' on the next.
Thus, when typing formulas in the text of a paragraph, keep the math properly
segregated: Don't take operators like $-$ and $=$ outside of the {\≡$≡\}'s,
and keep commas inside the formula if they are truly part of the formula.
But if a comma or period or other punctuation mark
belongs linguistically to the sentence rather than
to the formula, leave it outside the {\≡$≡\}'s.
\subsec 2. Roman letters in formulas. The names of algebraic variables
in formulas are usually italic or Greek letters, but common mathematical
operators like ``log'' are always set in roman type. The best way to deal
with such operators is to make use of the following control sequences (all of
which are defined in the {\tt basic} format of Appendix B):
$$\display\vbox{\halign{\tt\char'134#\hfill\qquad⊗\tt\char'134#\hfill\qquad
⊗\tt\char'134#\hfill\qquad⊗\tt\char'134#\hfill\qquad⊗\tt\char'134#\hfill\cr
cos⊗exp⊗lim⊗log⊗sec\cr
cot⊗gcd⊗liminf⊗max⊗sin\cr
csc⊗inf⊗limsup⊗min⊗sup\cr
det⊗lg⊗ln⊗Pr⊗tan\cr}}$$
The following examples show that such control sequences lead to roman type
as desired:
$$\vbox{\baselineskip15pt\lineskip6pt
\halign to size{\hskip 3pc\hbox to 225pt{#\hfill}⊗$#$\hfill
\tabskip 0pt plus 100pt\cr
\noalign{\vskip4pt}
Type⊗\hbox{\hskip-10pt and you get}\cr
\noalign{\vskip 4pt}
{\≡$\sin2\theta=2\sin\theta\cos\theta$≡\}⊗\sin2\theta=2\sin\theta\cos\theta\cr
{\≡$O(n\log n\log\log n)$≡\}⊗O(n\log n\log\log n)\cr
{\≡$\exp(-x↑2)$≡\}⊗\exp(-x↑2)\cr
{\≡$$\max≡↓{1≡≤n≡≤m}\log≡↓2P≡↓n$$≡\}⊗\dispstyle{\max↓{1≤n≤m}\log↓2P↓n}\cr
{\≡$$\lim≡↓{x→0}{\sin x\over x}=1$$≡\}⊗\dispstyle{\lim↓{x→0}{\sin x\over x}=1}\cr
\noalign{\vskip4pt}}}$$
In the second example, note that $O$ is an upper case letter ``oh'', not a zero;
a formula should usually have ``{\tt O}'' instead of ``{\tt0}'' when a left
parenthesis follows. The fourth and fifth examples show that some of the special
control sequences are treated by \TEX\ as ``large operators'' with limits
just like $\sum$; compare the different treatment of subscripts applied to
{\≡\max≡\} and to {\≡\log≡\}.
\danger Another way to get roman type into mathematical formulas is to
include constructed boxes (cf.\ Chapter 21); such boxes are treated the
same as single characters or subformulas. For example,
$$\displaybox{{\≡$\exp(x+\hbox{constant})$≡\}\qquad\hbox{yields}\qquad
$\exp(x+\hbox{constant})$\quad.\hfill}$$
The fonts used inside such boxes are the same as the fonts used {\sl outside}
of the math brackets {\≡$≡\}$\ldotsm${\≡$≡\}; the characters do {\sl not}
change size when the style changes.
\danger\dexno 18.1: Explain how to type the
phrase ``$n↑{\hbox{\:d th}}$ root'', where ``$n↑{\hbox{\:d th}}$'' is
treated as a mathematical formula with a superscript. The letters ``th'' should
be in font↔{\tt d}.\enddanger
\subsec3. Large parentheses and other delimiters.
Since mathematical formulas can get horribly large, \TEX\ has to have some
way to make ever-larger symbols.
For example, if you type
$$\displaybox{\vbox{\halign{#\hfill\cr
{\≡$$\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+≡\}\cr
{\≡≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ ≡ \sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}}$$≡\}\cr}}\hss}$$
the result shows a variety of available square-root signs:
$$\display\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}}$$
The three largest signs here are all essentially the same, except for a vertical
segment ``\vbox{\hbox{\:@\char'165}\vfill}'' that gets repeated as often as
necessary to reach the desired size; but the smaller signs are distinct characters
found in \TEX's math fonts.
...and so on.
\vfill\end